﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Somnus.Core.SceneManager;
using Somnus.Scenes;
using Somnus.Core;
using Somnus.Objects;

namespace Somnus.Core
{
    class Layer
    {
        public Vector2 Parallax { get; set; }
        public List<Background> Bgs { get; private set; }
        private readonly Camera2d _camera;

        public Layer(Camera2d camera)
        {
            _camera = camera;
            Parallax = Vector2.One;
            Bgs = new List<Background>();
        }

        public void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {
            spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, _camera.GetViewMatrix(Parallax));
            foreach(Background bg in Bgs)
                bg.Draw(gameTime,spriteBatch);
            spriteBatch.End();
        }
 

        
    }
}
